<?php

// 代码目前运行报错，需要一些列的配置，暂时没解决

$hostname = "localhost";
$port = 33060;
$database = "app.test";
$username = "root";
$password = "root";
 
try {
    // $pdo = new PDO("odbc:Driver={MySQL ODBC 3.51 Driver};host=$hostname;database=$database;port=$port", $username, $password);
    $pdo = new PDO("odbc:Driver={MySQL ODBC 3.51 Driver};host=$hostname;database=$database;port=$port", $username, $password);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 
    $sql = "SELECT * FROM test";
    $stmt = $pdo->query($sql);
    while ($row = $stmt->fetch()) {
        print( $row[0] . "-" . $row[1] . "-" . $row[2] . "\r\n");
    }
} catch (PDOException $e) {
    echo $e->getMessage();
    exit;
}

// close the connection
$dbh = null;